package com.kaifamiao.lambda;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class CalendarTest {

    public static void main(String[] args) {

        final Calendar calendar = new GregorianCalendar();

        // CalendarCleanable b = () -> calendar.clear();
        // 采用 "实例::实例方法名" 形式引用实例方法
        CalendarCleanable b = calendar::clear;
        b.clear();

        // CalendarAssignable x = (y,m,d) -> calendar.set(y,m,d);
        CalendarAssignable x = calendar::set;
        // 采用 "实例::实例方法名" 形式引用实例方法
        x.assign( 1999, 4, 10 );

        // CalendarLoadable a = () -> calendar.getTime();
        // 采用 "实例::实例方法名" 形式引用实例方法
        CalendarLoadable a = calendar::getTime;
        Date date = a.load();
        System.out.println( date );

    }

}
